package com.freesun.monitor.fs;

import org.csource.common.MyException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;

/**
 * 测试上传
 *
 * @author yangfei
 * @created  2013-12-11
 * @desc  通过线程下载
 */
public class MultDownFastDfs implements Runnable{

    private Logger log = LoggerFactory.getLogger(this.getClass());
    private String clientPath;
    private String group_name;
    private String remoteFileName;
    private String localeFileName;
    private String type;

    private FastDfs fastDfs;


    /**
     * @desc 初始化
     * @param clientPath
     * @param group_name
     * @param remoteFileName
     * @param localeFileName
     * @param type
     * @param fastDfs
     */
    public MultDownFastDfs(String clientPath,String group_name,String remoteFileName,String localeFileName,String type, FastDfs fastDfs){
        this.clientPath = clientPath;
        this.group_name = group_name;
        this.remoteFileName = remoteFileName;
        this.localeFileName = localeFileName;
        this.type = type;
        this.fastDfs = fastDfs;
    }



    @Override
    public void run() {

        try {
            this.fastDfs.downFile(clientPath,group_name,remoteFileName,localeFileName,type);
            log.debug("下载文件:"+remoteFileName+"成功!");
        } catch (IOException e) {
            log.error("下载文件:" + remoteFileName + "失败!");
            e.printStackTrace();
        } catch (MyException e) {
            log.error("下载文件:" + remoteFileName + "失败!");
            e.printStackTrace();
          }
    }

}